﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
  public  class TimKiem_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable taobang(string sql)
      {
          return kn.taobang(sql);
      }
      public DataTable Load_TimKiemTaiLieu()
      {
        return  kn.LayDuLieu("Load_TimKiemTaiLieu");
      }
      public DataTable TimKiem_TaiLieu_Full(TaiLieu_Public tenTaiLieu, TaiLieu_Public tacgia, TheLoai_public tenTheLoai)
      { 
           int n = 3;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@TenTaiLieu";
           value[0] = tenTaiLieu.TenTaiLieu;
           name[1] = "@TacGia";
           value[1] = tacgia.TacGia;
           name[2] = "@TenTheLoai";
           value[2] = tenTheLoai.TenTheLoai;
           return kn.LayDuLieu("TimKiem_TaiLieu_Full",name,value,n);
      }
      public DataTable TimKiem_TaiLieu_TenTaiLieu(TaiLieu_Public tenTaiLieu)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTaiLieu";
          value[0] = tenTaiLieu.TenTaiLieu;
          return kn.LayDuLieu("TimKiem_TaiLieu_TenTaiLieu", name, value, n);
      }
      public DataTable TimKiem_TaiLieu_TacGia(TaiLieu_Public tacgia)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TacGia";
          value[0] = tacgia.TacGia;
          return kn.LayDuLieu("TimKiem_TaiLieu_TacGia", name, value, n);
      }
      public DataTable TimKiem_TaiLieu_TheLoai(TheLoai_public theLoai)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTheLoai";
          value[0] = theLoai.TenTheLoai;
          return kn.LayDuLieu("TimKiem_TaiLieu_TheLoai", name, value, n);
      }
      public DataTable TimKiem_TenTaiLieu_TacGia(TaiLieu_Public tentailieu, TaiLieu_Public tacgia)
      {
          int n = 2;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTaiLieu";
          value[0] = tentailieu.TenTaiLieu;
          name[1] = "@TacGia";
          value[1] = tacgia.TacGia;
          return kn.LayDuLieu("TimKiem_TenTaiLieu_TacGia", name, value, n);
      }
      public DataTable TimKiem_TenTaiLieu_TenTheloai(TaiLieu_Public tentailieu, TheLoai_public tenTheloai)
      {
          int n = 2;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTaiLieu";
          value[0] = tentailieu.TenTaiLieu;
          name[1] = "@TenTheLoai";
          value[1] = tenTheloai.TenTheLoai;
          return kn.LayDuLieu("TimKiem_TenTaiLieu_TenTheLoai", name, value, n);
      }
      public DataTable TimKiem_MaDocGia(DocGia_Public maDocGia)
      {
          int n =1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaDocGia";
          value[0] = maDocGia.MaDocGia;
          return kn.LayDuLieu("TimKiem_MaDocGia", name, value, n);
      }
      public DataTable TimKiem_TenDocGia(DocGia_Public tenDocGia)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenDocGia";
          value[0] = tenDocGia.HoVaTen;
          return kn.LayDuLieu("TimKiem_TenDocGia", name, value, n);
      }
      public DataTable Load_MuonTra_TaiLieu()
      {
          return kn.LayDuLieu("Load_MuonTra_TaiLieu");
      }
      public DataTable TimKiem_TaiLieu_DangMuon(TaiLieu_Public tenTaiLieu)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTaiLieu";
          value[0] = tenTaiLieu.TenTaiLieu;
          return kn.LayDuLieu("TimKiem_TaiLieu_DangMuon", name, value, n);
      }
      public DataTable TiemKiem_TaiLieu(TaiLieu_Public tenTaiLieu)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenTaiLieu";
          value[0] = tenTaiLieu.TenTaiLieu;
          return kn.LayDuLieu("TiemKiem_TaiLieu", name, value, n);
      }
    }
}
